<?php
// +----------------------------------------------------------------------
// | ebSIG
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2020 http://www.ebsig.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: liudaojian <liudaojian@ebsig.com>
// +----------------------------------------------------------------------

/**
 * 商品接口类
 * @author   liudaojian <liudaojian@ebsig.com>
 * @version 1.0
 */

namespace App\Service\Rpc;

class Goods
{

    private $instance;

    public function __construct()
    {
        //项目标识
//        $project_index = config('system.project_index');
        $project_index = 'Kjb';
        if ($project_index) {

//            $project_index = ucfirst($project_index);



            //根据项目标识，实例相应类
            $class_name = __NAMESPACE__  . '\Goods\\' .$project_index . 'Goods';
            $this->instance = new $class_name;

        }


    }

    /**
     * 查询线下商品
     * @return mixed
     */
    public function query()
    {

        if (!is_object($this->instance)) {
            return ['code' => 404, 'message' => '实例对象没有找到'];
        }

        return $this->instance->query();

    }

    /**
     * 查询商品库存
     * @return mixed
     */
    public function queryLogistics()
    {
        if (!is_object($this->instance)) {
            return ['code' => 404, 'message' => '实例对象没有找到'];
        }

        return $this->instance->queryLogistics();
    }

}